package de.wepner.texteditor.ui;

import java.awt.Component;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.WindowConstants;

public class AboutDialog extends JDialog {
    
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private static final String DESCRIPTION_TEXT = "This Texteditor is a simple example for a model view controller application.";
    
    
    private JLabel descripion;
    
    
    public AboutDialog(Component window) {
        this.add(this.getDescription());
        
        this.setSize(240, 100);
        // this.pack();
        this.setResizable(false);
        this.setTitle("About the MVC Texteditor");
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setLocationRelativeTo(window);
    }
    
    
    private JLabel getDescription() {
        if (this.descripion == null) {
            this.descripion = new JLabel("<html><body style=\"padding: 5px;\">" + AboutDialog.DESCRIPTION_TEXT
                    + "</body></hmtl>");
        }
        return this.descripion;
    }
}
